package com.moon.icoresso.pojo.dto;

import lombok.Data;

/**
 * @ClassName ResonseDTO
 * @Description
 * @Author menbbo
 * @Date 2021/2/14 12:52
 * @Version V1.0
 **/
@Data
public class ResponseDTO<T>{
    private  int code;
    private  String message;
    private  T data;

    public  ResponseDTO<T> success(T data){
        ResponseDTO<T> responseDTO = new ResponseDTO<>();
        responseDTO.setCode(00000);
        responseDTO.setMessage("success");
        responseDTO.setData(data);
        return responseDTO;
    }

    public  ResponseDTO<T> error(String message){
        ResponseDTO<T> responseDTO = new ResponseDTO<>();
        responseDTO.setCode(500);
        responseDTO.setMessage(message);
        return responseDTO;
    }
}